﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace syh876.com.ajax.Account
{
    /// <summary>
    /// SendCode 的摘要说明
    /// </summary>
    public class SendCode : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string email = Common.RequestHelper.GetString("email");
            string sjcode = System.Guid.NewGuid().ToString().Replace("-", "").Remove(6);
            string MD5code = Common.MD5.Md5En(sjcode);

            Common.CookieHelper.AddCookies("CheckCode", MD5code);
            if (!Common.PageValidate.IsEmail(email))
            {
                context.Response.Write("0");
            }
            else
            {
                SYH.Utils.Mail.SendMail.SendCheckMailSMS(email, sjcode);
                context.Response.Write("1");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}